Skip to content

[log] Add debug logging to urlutil/domains#8005

Merged
lpcox merged 2 commits into
mainfrom
log/urlutil-domains-9475e953f7eb5722
Jun 23, 2026
Merged

[log] Add debug logging to urlutil/domains#8005
lpcox merged 2 commits into
mainfrom
log/urlutil-domains-9475e953f7eb5722

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Adds a logDomains debug logger (urlutil:domains namespace) and 4 meaningful debug log calls to internal/urlutil/domains.go.

Changes

File: internal/urlutil/domains.go

  • Added logger import and var logDomains = logger.New("urlutil:domains") declaration
  • ExtractURLDomains: logs the number of URL candidates found by the regex, logs unparseable URL candidates (useful when debugging edge cases with the regex), and logs the final unique domain count
  • ExtractURLDomainsFromValue: logs when no domains are found in the value tree, and logs the final extracted domain count

Why this file

urlutil.ExtractURLDomainsFromValue and ExtractURLDomains are called from the DIFC write-sink guard (guard/write_sink.go) and the JQ schema middleware (middleware/jqschema.go) to determine which domains appear in tool arguments/responses. Debug logging here helps trace:

  • How many URLs were extracted during guard evaluation
  • Whether any URL candidates were silently dropped due to parse errors
  • Domain extraction counts for both code paths

Validation

  • go vet ./internal/urlutil/
  • go build
  • All unit tests pass (go test $(go list ./... | grep -v test/integration)) ✅
  • Integration test failures are pre-existing (require binary at a standard path)

Generated by Go Logger Enhancement · 226.7 AIC · ⊞ 8.3K ·

Add logDomains debug logger (urlutil:domains namespace) and 4 meaningful
log calls to ExtractURLDomains and ExtractURLDomainsFromValue:

- Log URL candidate count found by regex
- Log unparseable URL candidates (for troubleshooting regex edge cases)
- Log final unique domain count resolved from candidates
- Log when no domains are found in the value tree

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added automation enhancement New feature or request labels Jun 23, 2026
@lpcox lpcox marked this pull request as ready for review June 23, 2026 23:51
Copilot AI review requested due to automatic review settings June 23, 2026 23:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds debug logging to internal/urlutil/domains.go to make it easier to trace how URL candidates are found and how many unique domains are extracted, which is useful for diagnosing DIFC write-sink guard and JQ schema middleware behavior.

Changes:

  • Added a debug logger (logDomains) in the urlutil:domains namespace.
  • Added debug logs for candidate counts and final unique domain counts in ExtractURLDomains and ExtractURLDomainsFromValue.
  • Added debug logging when URL candidates cannot be parsed.
Show a summary per file
File Description
internal/urlutil/domains.go Introduces a urlutil:domains debug logger and emits domain-extraction diagnostics (counts + parse failure visibility).

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 1

Comment thread internal/urlutil/domains.go
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
GitHub Advanced Security started work on behalf of lpcox June 23, 2026 23:54 View session
GitHub Advanced Security finished work on behalf of lpcox June 23, 2026 23:54
@lpcox lpcox merged commit 7623e1b into main Jun 23, 2026
27 checks passed
@lpcox lpcox deleted the log/urlutil-domains-9475e953f7eb5722 branch June 23, 2026 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants